package com.es.hr.visitorscore;

import javax.servlet.http.HttpServletRequest;

import com.es.business.area.AreaBiz;
import com.es.business.city.CityBiz;
import com.es.business.province.ProvinceBiz;
import com.es.util.page.PageBean;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class VisitorScoreSearchInitAction extends ActionSupport implements ServletRequestAware {
	HttpServletRequest request;

	public void setServletRequest(HttpServletRequest paramHttpServletRequest) {
		this.request = paramHttpServletRequest;
	}
	
	public String execute() throws Exception{
		String result = "";
		VisitorScoreBiz visitorBiz = new VisitorScoreBiz();
		int curpage = 1;
		if("".equals(request.getParameter("curpage")) || null == request.getParameter("curpage") ) {
			curpage = 1;
		} else {
			curpage = Integer.parseInt(request.getParameter("curpage"));
		}
		String areaCode = request.getParameter("areaCode");
		if(areaCode == null ) areaCode = "";
		String provinceCode = request.getParameter("provinceCode");
		if(provinceCode == null ) provinceCode = "";
		String ctm = request.getParameter("ctm");
		if(ctm == null ) ctm = "";
		String shopName = request.getParameter("shopName");
		if(shopName == null ) shopName = "";
		String starttime = request.getParameter("starttime");
		if(starttime == null) starttime = "";
		String endtime = request.getParameter("endtime");
		if(endtime == null) endtime = "";
		
		
		PageBean res = visitorBiz.searchVisitorScoreList(areaCode,provinceCode,ctm,shopName,starttime,endtime,curpage);
		this.request.setAttribute("pageBean", res);
		request.setAttribute("areas", new AreaBiz().getAreaList());
		request.setAttribute("provinces", new ProvinceBiz().getProvinceList());
		request.setAttribute("areaValue", areaCode);
		request.setAttribute("provinceName", provinceCode);
		request.setAttribute("ctm", ctm);
		request.setAttribute("shopName", shopName);
		request.setAttribute("starttime", starttime);
		request.setAttribute("endtime", endtime);
		result = "success";
		return result;
	}
}
